package com.xcw.utils;



import java.util.Map;

/**
 * @author eagle
 *
 */
public class BeanParamsValidator {
	/**判断参数是否为空*/
	public static void isNotBlack(Object bean,String...params) throws Exception {
		if(bean==null || params==null || params.length==0){
			return;
		}
		Map<String, Object> map = Bean2MapUtil.beanToMap(bean, params);
		for(String param:params){
			if(param == null || param.trim().equalsIgnoreCase("")){
				continue;
			}
			if(map.get(param)==null 
					|| map.get(param).toString().trim().equalsIgnoreCase("")){
				throw new Exception("参数"+param+"不能为空");
			}
		}
	}
}
